package cn.itcast.hotel.hotelcontroller;

import cn.itcast.hotel.dto.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import cn.itcast.hotel.vo.PageResult;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    private IHotelService iHotelService;
    @Autowired
    private RestHighLevelClient client;

    @PostMapping("/list")
    public PageResult list(@RequestBody RequestParams requestParams) throws IOException {
        return iHotelService.search(requestParams);
    }
}
